$(document).ready(function(){
	$('a[rel=tooltip][title]').qtip({
        position: {
           corner: {
              tooltip: 'leftMiddle',
              target: 'rightMiddle' // ...and opposite corner
           }
        },
        style: {
           border: {
              width: 5,
              radius: 10
           },
           width: { max: 300 },
           padding: 10, 
           textAlign: 'left',
           tip: true, // Give it a speech bubble tip with automatic corner detection
           name: 'dark' // Style it according to the preset 'cream' style
        }
	});
	
	$('input[rel=datepicker]').datepicker({ dateFormat: 'yy-mm-dd' });
	
	$('.lienpilote').qtip({
		         content: 'Voir detail',
		         position: 'bottomRight', // Set its position
		         hide: {
		            fixed: true // Make it fixed so it can be hovered over
		         },
		         style: {
		            padding: '5px 15px', // Give it some extra padding
		            name: 'dark' // And style it with the preset dark theme
		         }
	});
	
	$('.thumbnail').fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'overlayColor'	: '#000',
		'centerOnScroll': 'true',
		'titlePosition'	: 'inside'
	});
	
	$('a[rel=confirm]').click(function(e) {
		e.preventDefault();
		var url = $(this).attr('href');
		$('#confirm').dialog( "destroy" );
		$('#confirm').dialog({
			resizable: false,
			modal: true,
			buttons: {
				"Confirmer": function() {
					$( this ).dialog( "close" );
					window.location.replace(url);
				},
				"Annuler": function() {
					$( this ).dialog( "close" );
				}
			}
		});
	});
	
	$('#popup').dialog( "destroy" );
	$('#popup').dialog({
		resizable: false,
		modal: true,
		buttons: {
			"Ok": function() {
				$( this ).dialog( "close" );
			}
		}
	});
});